<template>
  <div id="sysInterfaceDiv">
    <div class="bodyContent">
      <Splitpanes>
        <Pane size="30">
          <vxe-toolbar perfect>
            <template #buttons>
              <vxe-input style="width: 180px" v-model="searchForm.searchValue" type="search" clearable class="vxeInputSearch" placeholder="关键字查询" @clear="findSysInterfaceList" @keyup="keyupEnter" @search-click="findSysInterfaceList()"></vxe-input>
              <vxe-button type="text" class="button-blue" icon="vxe-icon-refresh" content="刷新" :loading="iloading" @click="findSysInterfaceList"></vxe-button>
              <vxe-button type="text" class="button-blue" icon="vxe-icon-square-plus" content="新建" @click="addInterfaceDialog()"></vxe-button>
              <vxe-button type="text" icon="vxe-icon-delete" class="button-red" content="删除" @click="deleteBatchInterface"></vxe-button>
            </template>
          </vxe-toolbar>
          <div class="tableBody">
            <vxe-table ref="interfaceTableRef" class="mytable-scrollbar supplierTableClazz" border="inner" align="left" height="auto" :data="interfaceList" :loading="iloading" @current-change="InterfaceRowClick" :row-config="{ isCurrent: true, isHover: true }" :column-config="{ resizable: true }" resizable show-overflow keep-source>
              <vxe-column type="checkbox" width="30"></vxe-column>
              <vxe-column field="seq" title="序号" width="50"></vxe-column>
              <vxe-column field="interfaceCode" title="接口编码" width="100"></vxe-column>
              <vxe-column field="interfaceName" title="接口名称" width="200"> </vxe-column>
              <vxe-column field="hospName" title="所属医院" width="100"> </vxe-column>
              <vxe-column field="isEnable" title="是否启用" width="80">
                <template #default="{ row }">
                  <vxe-checkbox v-model="row.isEnable"></vxe-checkbox>
                </template>
              </vxe-column>
              <vxe-column field="isDebug" title="调试状态" width="80">
                <template #default="{ row }">
                  <vxe-checkbox v-model="row.isDebug"></vxe-checkbox>
                </template>
              </vxe-column>
              <vxe-column field="serviceThread" title="后台独立线程" width="80">
                <template #default="{ row }">
                  <vxe-checkbox v-model="row.serviceThread"></vxe-checkbox>
                </template>
              </vxe-column>
              <vxe-column field="interfaceType" title="接口类型" width="120">
                <template #default="{ row }">
                  <span>{{ formatCommon(interTypeList, row.interfaceType) }}</span>
                </template>
              </vxe-column>
              <vxe-column field="dbMs" title="数据库类型" width="100">
                <template #default="{ row }">
                  <span>{{ formatCommon(dbMsList, row.dbMs) }}</span>
                </template>
              </vxe-column>

              <vxe-column field="dbUrl" title="服务器名称或IP" width="130"> </vxe-column>
              <vxe-column field="dbName" title="数据库名称" width="100"> </vxe-column>
              <vxe-column field="barcodeLens" title="处理条码长度" width="100"> </vxe-column>
              <vxe-column field="delayProcess" title="延时处理时间(分)" width="100"> </vxe-column>
            </vxe-table>
          </div>
        </Pane>
        <Pane size="70">
          <el-tabs type="border-card" v-model="activeName" @tab-click="tabHandleClick">
            <el-tab-pane label="基础信息" name="first">
              <el-scrollbar>
                <el-form ref="interfaceFormRef" :model="interfaceForm" :rules="interfaceFormRule" label-width="120px" inline-message>

                  <el-row :gutter="24">
                    <el-col :span="12">
                      <el-form-item prop="hospId" label="所属医院">
                        <vxe-select v-model="interfaceForm.hospId" placeholder="请选择" ref="selectOrgRef" style="width: 100%;" filterable>
                          <vxe-option v-for="item in orgList" :key="item.id" :label="item.name" :value="item.id" />
                        </vxe-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="interfaceType" label="接口类型">
                        <vxe-select ref="refInterfaceType" v-model="interfaceForm.interfaceType" placeholder="请选择" style="width: 100%;" @change='changeType'>
                          <vxe-option v-for="item in interTypeList" :key="item.code" :label="item.name" :value="item.code" />
                        </vxe-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="interfaceCode" label="接口编码">
                        <el-input type="text" v-model="interfaceForm.interfaceCode" placeholder="请输入接口编码" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="interfaceName" label="接口名称">
                        <el-input type="text" v-model="interfaceForm.interfaceName" placeholder="请输入接口名称" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="是否独立线程" prop="serviceThread">
                        <el-switch v-model="interfaceForm.serviceThread" inline-prompt active-text="是" inactive-text="否"></el-switch>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="是否启用" prop="isEnable">
                        <el-switch v-model="interfaceForm.isEnable" inline-prompt active-text="是" inactive-text="否"></el-switch>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="是否调试状态" prop="isDebug">
                        <el-switch v-model="interfaceForm.isDebug" inline-prompt active-text="是" inactive-text="否"></el-switch>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="moduleId" label="模块">
                        <vxe-select v-model="interfaceForm.moduleId" placeholder="请选择" style="width: 100%;" disabled>
                          <vxe-option v-for="item in moduleList" :key="item.id" :label="item.name" :value="item.id" />
                        </vxe-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="systemId" label="系统">
                        <vxe-select v-model="interfaceForm.systemId" placeholder="请选择" style="width: 100%;" disabled>
                          <vxe-option v-for="item in systemList" :key="item.commonId" :label="item.name" :value="item.commonId" />
                        </vxe-select>
                      </el-form-item>
                    </el-col>
                    <!-- <el-col :span="12">
                      <el-form-item prop="devClassName" label="自定义对象名称">
                        <el-input type="text" v-model="interfaceForm.devClassName" :disabled="!isEmpty(interfaceForm.interfaceType) && interfaceForm.interfaceType == 'SQL'" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col> -->
                    <el-col :span="12" v-if="interfaceForm.interfaceType == 'SQL'">
                      <el-form-item prop="dbMs" label="数据库类型">
                        <vxe-select v-model="interfaceForm.dbMs" placeholder="请选择" style="width: 100%;">
                          <vxe-option v-for="item in dbMsList" :key="item.code" :label="item.name" :value="item.code" />
                        </vxe-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12" v-if="interfaceForm.interfaceType == 'SQL'">
                      <el-form-item prop="dbUrl" label="服务器名称或IP">
                        <el-input type="text" v-model="interfaceForm.dbUrl" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12" v-if="interfaceForm.interfaceType == 'SQL'">
                      <el-form-item prop="dbName" label="数据库名称">
                        <el-input type="text" v-model="interfaceForm.dbName" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="interfaceUrl" label="接口平台地址">
                        <el-input type="text" v-model="interfaceForm.interfaceUrl" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12" v-if="interfaceForm.interfaceType != 'SQL'">
                      <el-form-item prop="webUrl" label="接口地址">
                        <el-input type="text" v-model="interfaceForm.webUrl" :disabled="!isEmpty(interfaceForm.interfaceType) && interfaceForm.interfaceType == 'SQL'" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12" v-if="interfaceForm.interfaceType != 'SQL'">
                      <el-form-item prop="dbParm" label="其他连接参数">
                        <el-input type="text" v-model="interfaceForm.dbParm" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="logId" label="登录帐户">
                        <el-input type="text" v-model="interfaceForm.logId" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="logPass" label="帐户密码">
                        <el-input type="text" v-model="interfaceForm.logPass" placeholder="请输入" show-password></el-input>
                      </el-form-item>
                    </el-col>
                    <!-- <el-col :span="12">
                      <el-form-item prop="superLogId" label="超级用户账号">
                        <el-input type="text" v-model="interfaceForm.superLogId" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="superLogPass" label="超级用户密码">
                        <el-input type="text" v-model="interfaceForm.superLogPass" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="barcodeHeads" label="处理条码前缀">
                        <el-input type="text" v-model="interfaceForm.barcodeHeads" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="barcodeLens" label="处理条码长度">
                        <el-input type="text" v-model="interfaceForm.barcodeLens" placeholder="请输入" clearable></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item prop="delayProcess" label="延时处理时间(分)">
                        <el-input-number v-model="interfaceForm.delayProcess" />
                      </el-form-item>
                    </el-col> -->
                    <el-col :span="12">
                      <el-form-item prop="seq" label="序号">
                        <el-input-number v-model="interfaceForm.seq" :min="1" :max="1000" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item class="form-footer">
                        <template #default>
                          <el-button type="primary" @click="saveInterface('interfaceFormRef')">保存</el-button>
                        </template>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </el-scrollbar>
            </el-tab-pane>
            <el-tab-pane label="接口方法明细" name="second" :disabled="isEmpty(interfaceForm.id)">
              <InterfaceMethod ref="interMethodRef" />
            </el-tab-pane>
          </el-tabs>
        </Pane>
      </Splitpanes>
    </div>
  </div>
</template>

<script setup lang="ts">
// 引入组件区==========
import { ref, reactive, getCurrentInstance, nextTick, onMounted, watch } from 'vue';
import Breadcrumb from '@/components/Breadcrumb.vue'; //面包屑
import { Splitpanes, Pane } from 'splitpanes';
let { proxy }: any = getCurrentInstance();
import { VxeMessage, VxeNotifyType } from '@/utils/CommonMessage'; //提示框
import { AppStore } from '@/stores/store';
import { isEmpty } from 'lodash';
import InterfaceMethod from './InterfaceMethod.vue';
import { IsEmpty } from '@/utils/common';
import { funBdsJsResult } from '@/utils/Expression'; //函数公式
import { VXETable } from 'vxe-table'
import type { LegacyTodoList } from '@ckeditor/ckeditor5-list';



// 全局变量定义区 ==========
let store = AppStore();
let moduleList: any = reactive([]);
let systemList: any = reactive([]);
let interfaceList: any = reactive([]);
let dbMsList: any = reactive([]); //选择字典
let interTypeList: any = reactive([]);
let iloading = ref(false); //加载状态
let sltInterface: any = reactive({});
let searchForm = reactive({ searchValue: '', moduleId: '' });
let activeName = ref('first');
let interMethodRef: any = ref(null);
let orgList: any = reactive([]); //所有的组织机构


let interfaceForm = reactive({
  id: null,
  interfaceCode: '',
  interfaceName: '',
  hospId: '',
  hospCode: '',
  hospName: '',
  interfaceType: '',
  interfaceTypeName: '',
  webUrl: '',
  interfaceUrl: '',
  dbMs: '',
  dbUrl: '',
  dbName: '',
  dbParm: '',
  devClassName: '',
  logId: '',
  logPass: '',
  superLogId: '',
  superLogPass: '',
  barcodeHeads: '',
  barcodeLens: '',
  serviceThread: false,
  isEnable: false,
  delayProcess: 0,
  isDebug: false,
  moduleId: '',
  systemId: '',
  moduleName: '',
  seq: 1,
  orgId: ''
});

let interfaceFormRule = {
  // webUrl: [
  //   {
  //     required: true,
  //     message: '请输入接口地址',
  //     trigger: 'blur'
  //   }
  // ],
  interfaceUrl: [
    {
      required: true,
      message: '请输入接口平台地址',
      trigger: 'blur'
    }
  ],
  dbName: [
    {
      required: true,
      message: '请输入数据库名称',
      trigger: 'blur'
    }
  ],
  dbUrl: [
    {
      required: true,
      message: '请输入服务器名称或IP',
      trigger: 'blur'
    }
  ],
  dbMs: [
    {
      required: true,
      message: '请选择数据库类型',
      trigger: 'blur'
    }
  ],
  hospId: [
    {
      required: true,
      message: '请选择所属医院',
      trigger: 'blur'
    }
  ],
  interfaceType: [
    {
      required: true,
      message: '请选择接口类型',
      trigger: 'blur'
    }
  ],
  interfaceCode: [
    {
      required: true,
      message: '请输入接口编码',
      trigger: 'blur'
    }
  ],
  interfaceName: [
    {
      required: true,
      message: '请输入接口名称',
      trigger: 'blur'
    }
  ]
};
// let defaultProps = {
//   children: 'children',
//   label: 'name'
// };

let props = defineProps({
  systemId: String,
  moduleId: String,
  moduleSystemName: String,
}) as any;

watch(
  () => props.systemId,
  (n, o) => {
    findSysInterfaceList();
  },
  {
    deep: true,
    immediate: true
  }
);
watch(
  () => props.moduleId,
  (newval, oldvbal) => {
    findSysInterfaceList();
  },
  {
    deep: true,
  }
);

let typeValue = ref(null);

// 方法定义区 =============
// 页面加载时更新列表(左侧)
onMounted(() => {
  findOrgTree();
  findModuleList();
  getDictItemsList();
  // findSysInterfaceList();
});

function findOrgTree() {
  orgList.length = 0;
  const url = '/api/sys/findOrgTree';
  proxy.$http
    .get(url)
    .then((res: any) => {
      if (res.status.code !== 1) {
        proxy.$alert(res.status.msg, '提示');
      } else {
        orgList.push(...res.data.orgTree);
      }
    })
    .catch((err: any) => {
      VxeMessage('获取机构失败', VxeNotifyType.error);
    });
}

//批量获取字典
async function getDictItemsList() {
  let dictTreeTypeCodes: any = ['dbMsType', 'interfaceClassify', 'InterfaceSystem', 'interfaceType'];
  const codes = dictTreeTypeCodes.join(',');
  const url = '/api/sys/basDictDetail/findDictDetailListByDictCodes';
  const dictTreeTypeItems: any = await proxy.$http.get(url, { params: { code: codes } });
  const dbMsType = dictTreeTypeItems.data.find((item) => item.code === 'dbMsType');
  dbMsList.push(...dbMsType.detailDataList);
  const interfaceType = dictTreeTypeItems.data.find((item) => item.code === 'interfaceClassify');
  interTypeList.push(...interfaceType.detailDataList);
  // const interfaceType = dictTreeTypeItems.data.find((item) => item.code === 'interfaceType');
  // interTypeList.push(...interfaceType.detailDataList);
  let itemClassType = dictTreeTypeItems.data.find((item) => item.code === 'InterfaceSystem');
  systemList.push(...itemClassType.detailDataList);
}
function findModuleList() {
  moduleList.length = 0; //放入数据前清空数据
  const url = '/api/sys/getModuleList';
  proxy.$http
    //注意此处的数据条数
    .get(url, {
      params: { keywords: searchForm.searchValue }
    })
    .then((res: any) => {
      moduleList.push(...res.data.moduleList);
    })
    .catch((err: any) => {
      // VxeMessage('获取获取当前字典的字段列表失败',VxeNotifyType.error)
    });
}

// 回车查询
function keyupEnter(e: any) {
  if (e.$event.code == 'Enter') {
    findSysInterfaceList();
  }
}
function tabHandleClick(tab) {
  if (tab.index == 1) {
    interMethodRef.value.initPage(interfaceForm);
  }
}

function valueChangeEvent() {
  findSysInterfaceList();
}

function changeType(row) {
  let name = '';
  for (const item of interTypeList) {
    if (item.code == row.value) {
      name = item.name;
    }
  }
  interfaceForm.interfaceName = interfaceForm.interfaceName.substring(0, interfaceForm.interfaceName.lastIndexOf('-'));
  interfaceForm.interfaceName = interfaceForm.interfaceName + "-" + name;
  interfaceForm.interfaceCode = funBdsJsResult('firstPinYinFun', interfaceForm.interfaceName);
}

function findSysInterfaceList() {
  iloading.value = true;
  interfaceList.length = 0; //放入数据前清空数据
  const url = '/api/sys/sysInterface/findSysInterfaceList';
  proxy.$http
    //注意此处的数据条数
    .get(url, {
      params: {
        seachValue: searchForm.searchValue,
        moduleId: props.moduleId,
        systemId: props.systemId,
      }
    })
    .then((res: any) => {
      if (res.status.code === 1) {
        interfaceList.push(...res.data);
        iloading.value = false;
        const kn = interfaceList.find((k) => k.id == sltInterface.id);
        if (isEmpty(kn)) {
          InterfaceRowClick({ row: interfaceList[0] }); //默认选中第一条数据
        } else {
          InterfaceRowClick({ row: kn }); //默认选中第一条数据
        }
      } else {
        iloading.value = false;
        VxeMessage('获取列表失败', VxeNotifyType.error);
      }
    })
    .catch((err: any) => {
      iloading.value = false;
      // VxeMessage('获取获取当前字典的规则列表失败',VxeNotifyType.error)
    });
}

function InterfaceRowClick({ row }: any) {
  if (isEmpty(row)) {
    activeName.value = 'first';
    clearForm();
  } else {
    (proxy.$refs.interfaceTableRef as any).setCurrentRow(row);
    setInterfaceForm(row);
    if (activeName.value == 'second') {
      interMethodRef.value.initPage(interfaceForm);
    }
  }
}

function addInterfaceDialog() {
  clearForm();
  (proxy.$refs.interfaceTableRef as any).clearCurrentRow();
  activeName.value = 'first';
}

function saveInterface(formName: any) {
  let $el = proxy.$refs[formName];
  $el.validate((valid: any) => {
    if (!valid) {
      return false;
    }
    let url = '';
    let objData = {
      id: interfaceForm.id,
      interfaceCode: interfaceForm.interfaceCode,
      interfaceName: interfaceForm.interfaceName,
      hospId: interfaceForm.hospId,
      hospCode: interfaceForm.hospCode,
      hospName: interfaceForm.hospName,
      interfaceType: interfaceForm.interfaceType,
      interfaceTypeName: interfaceForm.interfaceTypeName,
      webUrl: interfaceForm.webUrl,
      interfaceUrl: interfaceForm.interfaceUrl,
      dbMs: interfaceForm.dbMs,
      dbUrl: interfaceForm.dbUrl,
      dbName: interfaceForm.dbName,
      dbParm: interfaceForm.dbParm,
      devClassName: interfaceForm.devClassName,
      logId: interfaceForm.logId,
      logPass: interfaceForm.logPass,
      superLogId: interfaceForm.superLogId,
      superLogPass: interfaceForm.superLogPass,
      barcodeHeads: interfaceForm.barcodeHeads,
      barcodeLens: interfaceForm.barcodeLens,
      serviceThread: interfaceForm.serviceThread,
      isEnable: interfaceForm.isEnable,
      isDebug: interfaceForm.isDebug,
      delayProcess: interfaceForm.delayProcess,
      moduleId: interfaceForm.moduleId,
      systemId: interfaceForm.systemId,
      moduleName: interfaceForm.moduleName,
      seq: interfaceForm.seq,
      orgId: isEmpty(interfaceForm.orgId) ? store.userInfo.orgId : interfaceForm.orgId,
    };
    console.log(objData);
    if (interfaceForm.id == null) {
      url = '/api/sys/sysInterface/addInterface';
    } else {
      // 修改用户
      url = '/api/sys/sysInterface/editInterface';
    }

    proxy.$http
      .post(url, objData)
      .then((res: any) => {
        if (res.status.code === 1) {
          VxeMessage('保存成功', VxeNotifyType.success);
          clearForm();
          sltInterface.id = res.data.id;
          findSysInterfaceList();
        } else {
          VxeMessage('保存失败1', VxeNotifyType.error);
        }
      })
      .catch((err: any) => {
        VxeMessage('保存失败2', VxeNotifyType.error);
      });
  });
}

async function deleteBatchInterface() {
  const sltInterfaces = (proxy.$refs.interfaceTableRef as any).getCheckboxRecords();
  if (!(sltInterfaces.length > 0)) {
    VxeMessage('请勾选要删除的数据', VxeNotifyType.info);
  } else {
    const type = await VXETable.modal.confirm('确定要删除当前勾选的数据？');
    if (type === 'confirm') {
      const data = { interfaceList: sltInterfaces };
      const url = '/api/sys/sysInterface/batchDeleteInterfaceList';
      proxy.$http
        .post(url, data)
        .then((res: any) => {
          if (res.status.code === 1) {
            findSysInterfaceList(); // 获取检验仪器表格数据
            VxeMessage('删除成功', VxeNotifyType.success);
          } else {
            VxeMessage(res.status.msg, VxeNotifyType.error);
          }
        })
        .catch((err: any) => {
          VxeMessage(err, VxeNotifyType.error);
        });
    }
  }
}

function clearForm() {
  interfaceForm.id = null;
  interfaceForm.interfaceCode = funBdsJsResult('firstPinYinFun', props.moduleSystemName);
  interfaceForm.interfaceName = props.moduleSystemName;
  interfaceForm.hospId = '';
  interfaceForm.hospCode = '';
  interfaceForm.hospName = '';
  interfaceForm.interfaceType = '';
  interfaceForm.interfaceTypeName = '';
  interfaceForm.webUrl = '';
  interfaceForm.interfaceUrl = '';
  interfaceForm.dbMs = '';
  interfaceForm.dbUrl = '';
  interfaceForm.dbName = '';
  interfaceForm.dbParm = '';
  interfaceForm.devClassName = '';
  interfaceForm.logId = '';
  interfaceForm.logPass = '';
  interfaceForm.superLogId = '';
  interfaceForm.superLogPass = '';
  interfaceForm.barcodeHeads = '';
  interfaceForm.barcodeLens = '';
  interfaceForm.moduleId = props.moduleId;
  interfaceForm.systemId = props.systemId;
  interfaceForm.moduleName = '';
  interfaceForm.delayProcess = 0;
  interfaceForm.serviceThread = false;
  interfaceForm.isEnable = false;
  interfaceForm.isDebug = false;
  interfaceForm.seq = interfaceList.length + 1;
  interfaceForm.orgId = '';
  // const treeName = 'orgTreeRef';
  // const tree: any = proxy.$refs[treeName];
  // tree.setCurrentKey(null);
  sltInterface = {};
}

function setInterfaceForm(row: any) {
  interfaceForm.id = row.id;
  interfaceForm.interfaceCode = row.interfaceCode;
  interfaceForm.interfaceName = row.interfaceName;
  interfaceForm.hospId = row.hospId;
  interfaceForm.hospCode = row.hospCode;
  interfaceForm.hospName = row.hospName;
  interfaceForm.interfaceType = row.interfaceType;
  interfaceForm.interfaceTypeName = row.interfaceTypeName;
  interfaceForm.webUrl = row.webUrl;
  interfaceForm.interfaceUrl = row.interfaceUrl;
  interfaceForm.dbMs = row.dbMs;
  interfaceForm.dbUrl = row.dbUrl;
  interfaceForm.dbName = row.dbName;
  interfaceForm.dbParm = row.dbParm;
  interfaceForm.devClassName = row.devClassName;
  interfaceForm.logId = row.logId;
  interfaceForm.logPass = row.logPass;
  interfaceForm.superLogId = row.superLogId;
  interfaceForm.superLogPass = row.superLogPass;
  interfaceForm.barcodeHeads = row.barcodeHeads;
  interfaceForm.barcodeLens = row.barcodeLens;
  interfaceForm.serviceThread = row.serviceThread;
  interfaceForm.isEnable = row.isEnable;
  interfaceForm.isDebug = row.isDebug;
  interfaceForm.delayProcess = row.delayProcess;
  interfaceForm.moduleId = row.moduleId;
  interfaceForm.systemId = row.systemId;
  interfaceForm.moduleName = row.moduleName;
  interfaceForm.seq = row.seq;
  interfaceForm.orgId = row.orgId;
  // setCurOrgTreeNode(interfaceForm.hospId);
  sltInterface = row;
}

// 光标定位在指定字典分类上
function setCurOrgTreeNode(nodeId: any) {
  proxy.$nextTick(() => {
    const treeName = 'orgTreeRef';
    const tree: any = proxy.$refs[treeName];
    tree.setCurrentKey(nodeId);
  });
}

function formatCommon(arr, value) {
  for (const item of arr) {
    if (item.code == value) {
      return item.name;
    }
  }
}
</script>

<style lang="scss" scoped>
#sysInterfaceDiv {
  height: 100%;

  .bodyContent {
    height: calc(100% - 60px);

    .splitpanes {
      background-color: $base-white;

      // 附加按钮间距
      .button-blue,
      .button-red {
        margin: 5px 0 5px 5px;
      }

      .tableBody {
        height: calc(100% - 40px);
      }

      .el-tabs {
        height: 100%;

        :deep(.el-tabs__content) {
          padding: 0;
          height: calc(100% - 39px);

          .el-tab-pane {
            height: 100%;
          }

          #pane-first {
            .el-form {
              padding: 20px;
            }
          }
        }
      }

      // 各个组件与右侧删除按钮的间距
      .vxe-checkbox {
        margin: 5px;
      }
    }
  }
}
</style>
